package com.game.euchre.Tests;

import static org.junit.Assert.*;

import org.junit.Test;

import com.game.euchre.Card;

public class CardTest {

	@Test
	public void testGetRank1() {
		Card test = new Card(0, 0, 0, 0);
		assertEquals("Error in getRank()",1,test.getRank());
	}
	
	@Test
	public void testGetRank2() {
		Card test = new Card(0, 1, 0, 1);
		assertEquals("Error in getRank()",2,test.getRank());
	}

	@Test
	public void testGetRank3() {
		Card test = new Card(0, 2, 0, 2);
		assertEquals("Error in getRank()",3,test.getRank());
	}
	
	@Test
	public void testGetRank4() {
		Card test = new Card(0, 3, 0, 3);
		assertEquals("Error in getRank()",4,test.getRank());
	}
	
	@Test
	public void testGetRank5() {
		Card test = new Card(0, 4, 0, 4);
		assertEquals("Error in getRank()",5,test.getRank());
	}
	
	@Test
	public void testGetRank6() {
		Card test = new Card(0, 5, 0, 5);
		assertEquals("Error in getRank()",6,test.getRank());
	}
	
	@Test
	public void testChangeSuit1() {
		Card input[] = {new Card(1,2,1,8)};
		int i = 0;
		String test = new Card(0,11,1,8).toString();
		
		input[0].changeSuit(input, i);
		String output = input[0].toString();
		assertEquals("Error in changeSuit()",test,output);
	}
	
	@Test
	public void testChangeSuit2() {
		Card input[] = {new Card(0,2,1,2)};
		int i = 0;
		String test = new Card(1,11,1,2).toString();
		
		input[0].changeSuit(input, i);
		String output = input[0].toString();
		assertEquals("Error in changeSuit()",test,output);
	}
	
	@Test
	public void testChangeSuit3() {
		Card input[] = {new Card(3,2,1,20)};
		int i = 0;
		String test = new Card(2,11,1,20).toString();
		
		input[0].changeSuit(input, i);
		String output = input[0].toString();
		assertEquals("Error in changeSuit()",test,output);
	}
	
	@Test
	public void testChangeSuit4() {
		Card input[] = {new Card(2,2,1,14)};
		int i = 0;
		String test = new Card(3,11,1,14).toString();
		
		input[0].changeSuit(input, i);
		String output = input[0].toString();
		assertEquals("Error in changeSuit()",test,output);
	}
	
	@Test
	public void testChangeRank() {
		Card input[] = {new Card(0,0,1,0),
						new Card(0,1,1,1),
						new Card(0,2,1,2),
						new Card(0,3,1,3),
						new Card(0,4,1,4)};
		
		String test1 = new Card(0,6,1,0).toString();
		String test2 = new Card(0,7,1,1).toString();
		String test3 = new Card(0,12,1,2).toString();
		String test4 = new Card(0,8,1,3).toString();
		String test5 = new Card(0,9,1,4).toString();
		
		input[0].changeRank(input);
	
		String output1 = input[0].toString();
		String output2 = input[1].toString();
		String output3 = input[2].toString();
		String output4 = input[3].toString();
		String output5 = input[4].toString();
		
		assertEquals("Error in changeRank()",test1,output1);
		assertEquals("Error in changeRank()",test2,output2);
		assertEquals("Error in changeRank()",test3,output3);
		assertEquals("Error in changeRank()",test4,output4);
		assertEquals("Error in changeRank()",test5,output5);
	}
	
	@Test
	public void testChangeTrump() {
		Card input[] = {new Card(0,0,0,0),
				new Card(0,1,0,1),
				new Card(0,2,0,2),
				new Card(0,3,0,3),
				new Card(0,4,0,4)};
		int card1 = 0;
		int card2 = 1;
		int card3 = 2;
		int card4 = 3;
		int card5 = 4;
		
		input[0].changeTrump(input,card1);
		input[1].changeTrump(input,card2);
		input[2].changeTrump(input,card3);
		input[3].changeTrump(input,card4);
		input[4].changeTrump(input,card5);
		
		
		String test1 = new Card(0,0,1,0).toString();
		String test2 = new Card(0,1,1,1).toString();
		String test3 = new Card(0,2,1,2).toString();
		String test4 = new Card(0,3,1,3).toString();
		String test5 = new Card(0,4,1,4).toString();
		
		String output1 = input[0].toString();
		String output2 = input[1].toString();
		String output3 = input[2].toString();
		String output4 = input[3].toString();
		String output5 = input[4].toString();
		
		assertEquals("Error in changeRank()",test1,output1);
		assertEquals("Error in changeRank()",test2,output2);
		assertEquals("Error in changeRank()",test3,output3);
		assertEquals("Error in changeRank()",test4,output4);
		assertEquals("Error in changeRank()",test5,output5);
	}
	
	
	
}
